<template>
        <div class="box"
             v-if="skeleton"
        @click="details">
             <div class="box_content_left"
                  v-if="(index+1)%2!==0"
                  @click="">
                      <div class="left_content">
                          <h3 class="title">{{content.title}}</h3>
                          <p class="boys" v-html="content.content"></p>
                          <span class="operate">
                             <span class="choose">
                                    <img src="/img/common/sq_liulan.png" alt="" style="width:20px">{{content.releaseTime}}
                             </span>
                            <span class="detail"> 点击查看详情</span>
                          </span>
                      </div>
             </div>
              <div  class="box_content_right"
                 v-else @click="">
                <div class="left_content">
                    <h3 class="title">{{content.title}}</h3>
                    <p class="boys">{{content.content}}</p>
                    <span class="operate">
                         <span class="choose">
                                <img src="/img/common/sq_liulan.png" alt="" style="width:20px">{{content.releaseTime}}
                         </span>
                         <span class="detail"> 点击查看详情</span>
                    </span>
                </div>
            </div>
        </div>
  <div v-else class=" box_content_left">
    <div class="circle_box">
        <CircleLoading></CircleLoading>
    </div>
  </div>
</template>

<script>
import CircleLoading from "@/components/PublicComponents/CircleLoading.vue";

export default {
    name: "OnlookerContent",
    components: {CircleLoading},
    props:['content','index'],
    data(){
        return{
            skeleton:false,
            content_:"",
        }
    },
    mounted() {
        this.content_ = this.content
    },
    watch:{
        content_(newValue,oldValue){
            if(newValue !== ""){
                setTimeout(()=>{
                    this.skeleton = true
                },100)
            }
        }
    },
    methods:{
        details(){

            },
    }
}
</script>

<style scoped>
.circle_box{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    border-radius:5px;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    background: rgba(246, 247, 248, 0.7);
}
.box,.box_content_left,.box_content_right{
    width:  800px;
    height: 22vh;
    min-width: 450px;
    min-height: 180px;
    margin-bottom: 30px;
    transition: all .4s;
    border-radius: 3px;
    box-shadow: 0 1px 5px 1px rgba(152, 148, 148, 0.2);
    animation: box .3s ease-in-out 0s 1 forwards;
}
@keyframes box {
    0%{
       transform: scale(0);
    }100%{
     transform: scale(1);
         }
}
  .box:hover{
      cursor: pointer;
  }
  .box_content_left,.box_content_right{
      display: flex;
      justify-content: space-between;
      align-items: center;
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
  }
  .left_content{
      padding: 10px 10px;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;
  }
.left_content:hover .title{
    opacity: .7;
    transform: translateY(-5px);
}
  .image{
      width: 16vw;
      min-width: 250px;
      height: 100%;
      border-radius: 3px;
  }
  .title{
      width: 100%;
      font-size: 25px;
      font-weight: bolder;
      text-align: center;
      padding:0 10px 12px  10px;
      overflow: hidden;
      text-overflow:ellipsis;
      white-space: nowrap;
      transition: all .3s;
  }
  .boys{
      text-indent: 1rem;
      padding: 0 10px;
      font-size: 15px;
      text-overflow: ellipsis;
      max-height: 150px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
      overflow: hidden;
      width: 100%;
      height: 100%;
      word-break: break-all;
  }
  .operate{
      display: flex;
      justify-content: space-between;
      align-items: center;
      text-align: right;
      width: 100%;
      font-size: 14px;
  }
.operate:hover .detail{
    text-decoration: underline;
}
.choose{
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (min-width:900px) and (max-width: 1200px) {
    .box,.box_content_left,.box_content_right{
        width: 600px;
    }
}
@media (min-width:0px) and (max-width: 900px) {
    .image{
        display: none;
    }
    .box,.box_content_left,.box_content_right{
        width: 450px;
    }
}
@media (min-width:0px) and (max-width: 600px) {
    .box,.box_content_left,.box_content_right{
        width: 380px !important;
        min-width: 380px !important;
    }
}
</style>